<template>
  <view class="mood-selector">
    <view class="mood-title">今日心情</view>
    <view class="mood-options">
      <view 
        v-for="(mood, index) in moods" 
        :key="index"
        class="mood-item"
        :class="{ active: selectedMood === mood.value }"
        @click="selectMood(mood.value)"
      >
        <text class="mood-emoji">{{ mood.emoji }}</text>
        <text class="mood-label">{{ mood.label }}</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'MoodSelector',
  data() {
    return {
      selectedMood: '',
      moods: [
        { value: 'happy', emoji: '😊', label: '开心' },
        { value: 'neutral', emoji: '😐', label: '一般' },
        { value: 'sad', emoji: '😔', label: '低落' },
        { value: 'excited', emoji: '😃', label: '兴奋' },
        { value: 'tired', emoji: '😴', label: '疲惫' }
      ]
    }
  },
  methods: {
    selectMood(mood) {
      this.selectedMood = mood
      this.$emit('select', mood)
    },
    reset() {
      this.selectedMood = ''
    }
  }
}
</script>

<style scoped>
.mood-selector {
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}

.mood-title {
  font-size: 32rpx;
  color: #333;
  margin-bottom: 30rpx;
  font-weight: bold;
  text-align: center;
  position: relative;
}

.mood-title::after {
  content: '';
  position: absolute;
  bottom: -10rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 60rpx;
  height: 4rpx;
  background-color: #f3e5f5;
  border-radius: 2rpx;
}

.mood-options {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 20rpx;
}

.mood-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 18%;
  padding: 16rpx 0;
  border-radius: 12rpx;
  transition: all 0.3s;
  border: 2rpx solid transparent;
}

.mood-item.active {
  background-color: #f3e5f5;
  box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  border: 2rpx solid #e1bee7;
  transform: scale(1.05);
}

.mood-emoji {
  font-size: 48rpx;
  margin-bottom: 12rpx;
}

.mood-label {
  font-size: 24rpx;
  color: #666;
  font-weight: 500;
}
</style>